#include <stdio.h>

int main( int argc, const char* argv[] )
{
	if(argc < 3) {
		printf("usage: copy source_path target_path\n");
		return;
	}
	const char *source = argv[1];
	const char *target = argv[2];
	FILE *sourceFile = fopen(source, "r");
	FILE *targetFile = fopen(target, "w");
	if (sourceFile == NULL) perror ("Can't open source file");
	else if (targetFile == NULL) perror ("Can't open target file");
	else {
		int c, b = 0;
		while (EOF != (c = fgetc(sourceFile))) {
			fputc(c, targetFile);
			b++;
		}
		fclose(sourceFile);
		fclose(targetFile);
		printf("Copied file from %s to %s (%i bytes)", source, target, b);
	}
}
